
function getVar(block: any) {
    let id = block.getFieldValue('VARIABLE')
    let varBlock = Blockly.Variables.getVariable(block.workspace, id)
    return `be.var["${varBlock.name}"]`
}

export default function(coder: any) {

    coder['data_variable'] = function(block: any) {
        return [getVar(block), coder.ORDER_ATOMIC]
    }
    coder['data_setvariableto'] = function(block: any) {
        var argument0 = coder.valueToCode(block, 'VALUE', coder.ORDER_ASSIGNMENT) || '0'
        return coder.indentString() + getVar(block) + ' = ' + argument0 + ';\n'
    }
    coder['data_changevariableby'] = function(block: any) {
        var argument0 = coder.valueToCode(block, 'VALUE', coder.ORDER_ASSIGNMENT) || '0'
        return coder.indentString() + getVar(block) + '+= ' + argument0 + ';\n'
    }

    
}